﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Main.aspx.cs" Inherits="JKF.Web.Main" %>

<%@ Import Namespace="JKF.Substructure" %>
<%@ Register Assembly="OfficeWebUI" Namespace="OfficeWebUI" TagPrefix="OfficeWebUI" %>
<%@ Register Assembly="OfficeWebUI" Namespace="OfficeWebUI.Ribbon" TagPrefix="OfficeWebUI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="App_Themes/Theme2/CustomRibbon.css"  rel="stylesheet" type="text/css" />
    <link href="App_Themes/Theme2/tab.css"   rel="stylesheet" type="text/css" />
    <link href="App_Themes/Theme2/Include.css"   rel="stylesheet" type="text/css" />
</head>
<!--<body class="body_bg">-->
<body >
    <script src="<%= ResolveUrl("~/js/jquery.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/js/jquery.1.5.js") %>" type="text/javascript"></script>
    <script  src="js/tabHelper.js"  type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/js/Uppop/tipswindown2.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/js/jquery-ui-custom.min.js") %>" type="text/javascript"></script>

     <%=this.RegScript("~/css/skin/default/mainmenu/main_button_xc.js")%>
    <script type="text/javascript" language="javascript">
        var callBackFun; //回调函数变量
        /*1
        参数说明
        title:标题名称；
        url：传递的url；
        width:宽度；
        height：高度；
        cancelFun:弹出层关闭之后调用的回调函数名称，通常用来更新列表中的信息，比如往列表中加一行信息，
        */
        function pop(title, url, width, height, cancelFun) { 
            tipsWindown(title, "iframe:" + url, width, height, "true", "", "true", "text");
            callBackFun = cancelFun;
        };

        //调用父窗体弹出层返回信息
        function popRetuInfo(obj, id) {
            callBackFun(obj, id);
        }
    </script>
    <script type="text/javascript">
        top.window.tabable=true;
        var pgNameReg =/[^/]+(\/)?[^/]+\.aspx/i;
        var docHeight=$(window).height();
        $(function() {
            
		    $('.RibbonItems_LargeItem, .RibbonItems_MediumItem').click(function () {
                $('.Checked').removeClass('Checked');
                $(this).addClass('Checked');
            })
			
		    $('.RibbonGroupTitle').parent().remove();
  
            $("[ContextID='RibbonContext1']").removeAttr("style")
            $("[ContextID='RibbonContext1']").attr("style","float:left;");
             
            $("[ContextID='RibbonContext1']").attr("style","float:left;");
     

            $(".RibbonItems_LargeItem").each(function(){
                var item=$(this);
                if (item.attr("href") != "#") {
                    //if(!(item.attr("target")!=null && item.attr("target")!=undefined && item.attr("target")=="open")){
					if(!(item.attr("target")!=null && item.attr("target")!=undefined )){
                        item.attr("src", item.attr("href"));
                        pgName = pgNameReg.exec(item.attr("href"));
						//alert(pgName);
						
                        if (pgName != (null || undefined) && pgName.length > 0) 
						   item.attr("key", pgName[0]);
                        else item.attr("key", item.attr("href"));
                          item.click(function() {window.top.tabObjFac(this);});                    
                        item.attr("href", "javascript:");
						
                    }
                }
            });
            
            $(window).resize(function(){
                var w = $(document).find("body").width();
                if(w%125 < 45) w = w - 45;
                var wMain = w%125 < 45 ? (w - 45) - (w - 45)%125 : w - w%125;
                
                $("#main").width(wMain);
                docHeight=$(window).height();
                $(".position_cet").width($(window).width()-700);
                $(".position_cet marquee").width($(".position_cet").width()-80);
            });
            $(window).resize();
            
            var t= $(".ApplicationButtonContainer");
            t.empty();
            t.html('<img src="'+$("img[id$='Image1']").attr("src")+'" />');

            var container=$(".RibbonContextsContainer");
            $("<span class='user_login'><span class='f12white'>当前用户:</span><span class='f12yewwo'>[<%=ShopName %>]&nbsp;&nbsp;<%=Account%></span><span class='f12green'>&nbsp;<a href='Logout.ashx'>退出</a>&nbsp;</span></span>").insertAfter(container.find(".RibbonContext"));
            /*
            $("<div id='navCtn'><a id='navLeft' href='javascript:' onclick='mve(true);return false;'></a><a id='navRight' href='javascript:' onclick='mve(false);return false;'></a></div>").insertAfter(container.find(".RibbonContext"));*/

            window.CurM = new moduleManager($("#tab"),$("#main"),$("#divMain"));
            var md = new module("index.aspx", "首页", "首页", "index.aspx", false);
            CurM.selTabClass = "sel";
            CurM.norTabClass = "nor";
            CurM.tbLeft=$("#tb_left");
            CurM.tbRight=$("#tb_right");
            CurM.createModule(md);
            CurM.showModule(md.group);
            length2Title($("#lblunitname"),10);
        });
        
        function length2Title(jqElement,maxlth){
            var s=jqElement.text().split("(");
            var ttl=jqElement.text();
            if(s[0].length>maxlth){
                jqElement.text(jqElement.text().substring(0,maxlth));
                jqElement.attr("title",ttl);
            }            
        }        
        
        function tabObjFac(obj) {
            var cur = $(obj);
            showModule(cur);
            top.window.tabable = true;
        }
        //function getHt(){ return docHeight-$("#RibbionMenu").height()-76;}
        function getHt(){ return docHeight-$("#RibbionMenu").height()-172;}
        function showModule(tagEle) {
            if(tagEle.attr("key")!="main.aspx") {
               objs = new module(tagEle.attr("key"),tagEle.attr("title"),tagEle.attr("title"), tagEle.attr("src"), true);}
            else {
               objs= new module("main.aspx", "首页", "首页", "main.aspx", false);
               }
            if (!CurM.exists(objs.group)) {
               CurM.modules[objs.group] = objs;
               }
            CurM.createModule(CurM.modules[objs.group]);
            CurM.showModule(objs.group);
        }
        function fxMainWdth(){
            var mods=$(".itab[gp]");
	        mods.each(function(){ if($(this).css("display").toLowerCase()=="block"){$("#main").width($(this).find("iframe").eq(0).width()-50);return;} });
            CurM.opTabMover();
        }
        function fxwidth(){}
        
        //pgSrc:类似于tab2中链接的页面路径
        function f5Page(pgSrc) {
            if(pgSrc!=(null || undefined) && $.trim(pgSrc).length>0){
                var keyReg=/[^/]+(\/)?[^/]+\.aspx/i;
                var keyName=keyReg.exec(pgSrc);
                if(!(keyName!=(null || undefined) && keyName.length>0)){
                    keyName=new Array();
                    keyName[0]=pgSrc;
                }
                var tag=$(".itab[gp*='"+keyName[0]+"']");
                if(tag.size()>0){
                    if(tag.eq(0).css("display")!="none"){
                        var pg=tag.eq(0).find("iframe");
                        var url=pg.attr("src");
                        pg.attr("src",url);                        
                    }
                }
            }
        }
        function mve(bLeft){
            var scr=$(".RibbonTabContent:visible");
            var step=100;
            if(scr.size()>0) {
                var moveTo=scr.scrollLeft()+(bLeft?-step:step);
                if(moveTo>0)scr.animate({scrollLeft:moveTo},500);
                else scr.animate({scrollLeft:0},500);
            }
        }

        //如时候从一个模块跳转到另一个模块而且还带参数，从菜单里进入是不带参数的
        //（实现的原理是通过jquery更改菜单，然后调用打开某个菜单的方法进入相应模块，跳转完了把菜单改回去）
        //调用如：window.parent.parent.goPage('Contract/Sales_Contract_View.aspx销售合同管理','.RibbonZoneContent div[title=\'销售合同管理\']
        function goPage(url,obj,params)
        { 
           CurM.removeModule(url); //先移除原来页面
           tmpSrc=$(obj).attr("src"); //记录更改之前菜单url
           if(params!=""){//如果参数不为空，更改菜单
             $(obj).attr("src",tmpSrc+params);
           }
           tabObjFac($(obj));//打开相应模块
           $(obj).attr("src",tmpSrc); //当实现了页面跳转时，还原菜单。这个很重要 
        }
    </script>

    <!-- 加载菜单扩展样式 -->
    <!--[if IE 9]>
    <link href="<%=ResolveUrl("~/css/skin/default/CustomTheme/CustomRibbon_8.css")%>" rel="stylesheet" type="text/css" />
    <![endif]-->
    <!--[if IE 8]>
    <link href="<%=ResolveUrl("~/css/skin/default/CustomTheme/CustomRibbon_8.css")%>" rel="stylesheet" type="text/css" />
    <![endif]-->
    <!--[if IE 7]>
    <link href="<%=ResolveUrl("~/css/skin/default/CustomTheme/CustomRibbon_7.css")%>" rel="stylesheet" type="text/css" />
    <![endif]-->
    <!-- 加载菜单扩展样式 结束 -->
    <form id="form1" runat="server">
    <div class="warrper">
    	  <div id="wrapper" class="warrper_in">   
		      <div class="top_line"></div>
		       <div class="header">
			       <div style="margin-left:84px; ">
                        <!-- 主导航 -->
                        <div id="mainmenu" style="top: -40px; ">
                                  <OfficeWebUI:Manager ID="Manager1" runat="server" UITheme="Custom" CustomCSSFile="App_Themes/Theme2/CustomRibbon.css" IncludeJQuery="false" ChromeUI="true" />
            <OfficeWebUI:OfficeRibbon ID="OfficeRibbon1" runat="server" ApplicationMenuType="None" ApplicationMenuText="">
                <Contexts>
                    <OfficeWebUI:RibbonContext ID="RibbonContext1" runat="server" ContextColor="#fff"  Text="">
                        <Tabs></Tabs>
                    </OfficeWebUI:RibbonContext>
                </Contexts>
            </OfficeWebUI:OfficeRibbon>
                       </div>
                   </div>
	          </div>

              <div id="divMain">
				    <div class="tab" id="tbopwrap" style="float:right;">
						 <a id="tb_left" class="tb_com" href="javascript:" onclick="CurM.marqModule(true);"></a>
						 <a id="tb_right" class="tb_com" href="javascript:" onclick="CurM.marqModule(false);"></a>
				    </div>						
				    <div id="main" style="float:left;">
					    <ul id="tab"> </ul>					   
				    </div>
				    <br clear="all" />
		      </div> 
          </div>  <!-- warrper_in结束 -->
    </div>
  </form> 
  <script type="text/javascript">
      $(function () {
          $("[ContextID='RibbonContext1']").removeAttr("style")
          $("[ContextID='RibbonContext1']").attr("style", "float:left;");
      });
  </script> 
</body>
</html>
